﻿// <copyright file="WorldGenerator.PrivateMethods.cs" company="TenneySoftware">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>Robert Tenney</author>
// <email>rob10e@yahoo.com</email>
// <date>April 2009</date>
// <summary>World level generator.</summary>

// License:

// Product: World.csproj
// Author: Robert N. Tenney
// Copyright: 9/14/2009

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// This license covers all source code, binaries, and other materials related to this project
// unless specifically stated otherwise.

using System;
using System.Drawing;
using TenneySoftware.Engine;

namespace TenneySoftware.LevelGenerator.WorldGenerator {
    /// <content>
    /// This file contains the Private methods for the generator.
    /// </content>
    public partial class World {
        /// <summary>
        /// Sets the name of the setting.
        /// </summary>
        /// <param name="name">Name to set the setting to.</param>
        private void SetName(string name) {
            this.settingsName = name;
        }
        
        /// <summary>
        /// Generates the world level.
        /// </summary>
        /// <returns>True if level is generated.</returns>
        private bool WorldGenerate() {
            bool result = false;

            result = true;
            return result;
        }
        
        /// <summary>
        /// Initializes the variables and the level for a fresh generation.
        /// </summary>
        private void Initialize() {
            // Set random seed. If one was given, then use that, if not, use default.
            if (this.seed != 0) {
                this.rand = new Random(this.seed);
            } else {
                this.rand = new Random();
            }
            
            if (this.Level == null) {
                this.SetSize(new Size(64, 64));
            }

            // Fill level with default tiles which is a wall tile.
            for (int y = this.level.Bounds.Top; y <= this.level.Bounds.Bottom; y++) {
                for (int x = this.level.Bounds.Left; x <= this.level.Bounds.Right; x++) {
                    TileData temp = new TileData();
                    temp.TypeOfTile = TileType.Floor;
                    temp.TypeVariation = TileTypeVariation.Grass;
                    this.level.SetLevel(x, y, temp);
                }
            }
        }
    }
}